package base.thread;

// 继承Thread
public class Thread01 {

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();
        System.out.println("主线程"+Thread.currentThread().getName());
    }
}

class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println("线程开启"+Thread.currentThread().getName());
        //睡一秒
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
